'use strict';

const Controller = require('egg').Controller;

class HomeController extends Controller {

  async login() {
    const { ctx, app, service } = this;
    const str = ctx.request.body;
    console.log(str);
    const con = await service.admin.login.login(str);
    ctx.set({ authorization: con.token });// 设置headers
    ctx.body = con;
  }
  async index() {
    const { ctx, app, service } = this;
    const token = ctx.request.header.authorization;
    console.log(token,'7777');
    const con = await service.admin.login.index(token);
    ctx.body = con;
  }
}

module.exports = HomeController;
